package gui;

import facade.CarInfo;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.Point2D;

public abstract class DisplayedTrafficInfrastructure extends DisplayedObject {

	@Override
	public abstract void draw(Graphics2D g2d);
	
	protected void drawCar(Graphics2D g2d, CarInfo car, Shape rect, Point2D textPoint) {
		if(car != null) {
			Color savedColor = g2d.getColor();
			
			int hash = car.label.hashCode();
			g2d.setColor(new Color(hash));
			g2d.fill(rect);
			
			g2d.setColor(savedColor);
			drawString(g2d, car.label, textPoint);
		}
	}

}
